<template>
    <view class="container">
        <sc-navbar title="订单详情" back bg-color="#eee"></sc-navbar>
        <glo-gutter>
            <glo-chunk>
                <sc-flex ai="center" jc="between">
                    <sc-flex ai="center" col-gap="23">
                        <glo-title title="手术信息"></glo-title>
                        <glo-tag type="primary" text="已完成"></glo-tag>
                    </sc-flex>
                    <sc-button type="line" text="修改信息" width="112" height="30"></sc-button>
                </sc-flex>
                <glo-info :info="getSurgicalInfo({})" :labelStyle="{ width: '230rpx' }" mt="13"></glo-info>
            </glo-chunk>
            <glo-chunk>
                <glo-title title="跟台信息"></glo-title>
                <sc-view padding="13rpx 0">
                    <glo-info :info="getWithTaiInfo({})" :labelStyle="{ width: '230rpx' }"></glo-info>
                </sc-view>
                <sc-flex ai="center" jc="end">
                    <sc-button type="line" text="联系跟台员" width="135" height="30"></sc-button>
                </sc-flex>
            </glo-chunk>
            <glo-chunk>
                <sc-flex ai="center" jc="between">
                    <sc-flex ai="center" col-gap="23">
                        <glo-title title="配送信息"></glo-title>
                        <glo-tag type="primary" text="已配送"></glo-tag>
                    </sc-flex>
                    <sc-button type="line" text="物流信息" width="112" height="30"
                        @click="$sc.push('/subOrder/pages/logisticsInfo')"></sc-button>
                </sc-flex>
                <glo-info :info="getDeliveryInfo({})" :labelStyle="{ width: '230rpx' }" mt="13"></glo-info>
                <view class="dotted-line">
                </view>
                <sc-grid row-gap="12">
                    <!-- 钉盒 -->
                    <glo-chunk shadow>
                        <sc-flex ai="center" jc="between">
                            <glo-title title="钉盒标题" />
                            <sc-icon name="arrow-right" color="primary" size="20" />
                        </sc-flex>
                        <sc-flex ai="center" col-gap="33" padding="13rpx 0">
                            <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                            <glo-info :info="getDingHeInfo({})"></glo-info>
                        </sc-flex>
                        <glo-statistics :statistics="[{ name: '所含数量', value: 55 }]"></glo-statistics>
                    </glo-chunk>
                    <!-- 套包 -->
                    <glo-chunk shadow>
                        <sc-flex ai="center" jc="between">
                            <glo-title title="套包" />
                            <sc-icon name="arrow-right" color="primary" size="20" />
                        </sc-flex>
                        <sc-flex ai="center" col-gap="33" padding="13rpx 0">
                            <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                            <glo-info :info="getTaoBaoInfo({})"></glo-info>
                        </sc-flex>
                        <glo-statistics
                            :statistics="[{ name: '所含数量', value: 55 }, { name: '收货数量', value: 55 }, { name: '遗失数量', value: '55' }]"></glo-statistics>
                    </glo-chunk>
                    <!-- 商品 -->
                    <glo-chunk shadow>
                        <sc-flex ai="center" jc="between">
                            <glo-title title="商品" />
                            <sc-icon name="arrow-right" color="primary" size="20" />
                        </sc-flex>
                        <sc-grid>
                            <sc-grid ai="center" col="90rpx auto" col-gap="33">
                                <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                                <glo-info :info="getCommodityInfoA({})"></glo-info>
                            </sc-grid>
                            <glo-info :info="getCommodityInfoB({})"></glo-info>
                        </sc-grid>
                        <glo-statistics
                            :statistics="[{ name: '所含数量', value: 55 }, { name: '收货数量', value: 55 }, { name: '遗失数量', value: '55' }]"></glo-statistics>
                    </glo-chunk>
                    <!-- 工具组 -->
                    <glo-chunk shadow>
                        <sc-flex ai="center" jc="between">
                            <glo-title title="工具组" />
                            <sc-icon name="arrow-right" color="primary" size="20" />
                        </sc-flex>
                        <sc-flex ai="center" col-gap="33" padding="13rpx 0">
                            <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                            <glo-info :info="getToolGroupInfo({})"></glo-info>
                        </sc-flex>
                        <glo-statistics
                            :statistics="[{ name: '所含数量', value: 55 }, { name: '收货数量', value: 55 }, { name: '遗失数量', value: '55' }]"></glo-statistics>
                    </glo-chunk>
                    <!-- 工具 -->
                    <glo-chunk shadow>
                        <sc-flex ai="center" jc="between">
                            <glo-title title="工具" />
                            <sc-icon name="arrow-right" color="primary" size="20" />
                        </sc-flex>
                        <sc-grid ai="center" col-gap="33" padding="13rpx 0" col="90rpx 1fr">
                            <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                            <glo-info :info="getToolInfo({})"></glo-info>
                        </sc-grid>
                        <glo-statistics
                            :statistics="[{ name: '所含数量', value: 55 }, { name: '收货数量', value: 55 }, { name: '遗失数量', value: '55' }]"></glo-statistics>
                    </glo-chunk>
                </sc-grid>
            </glo-chunk>
            <glo-chunk>
                <sc-flex ai="center" col-gap="23">
                    <glo-title title="配送信息"></glo-title>
                    <glo-tag type="primary" text="已消毒"></glo-tag>
                </sc-flex>
                <sc-flex padding="23rpx 0" col-gap="27" ai="center">
                    <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                    <sc-flex direction="t">
                        <sc-text text="湖北省武汉市汉阳区龙阳大道8号九州通大厦二期" size="23" color="#3D3D3D"></sc-text>
                        <sc-text text="2025-11-27 17:52:22" size="23" color="#3D3D3D"></sc-text>
                    </sc-flex>
                </sc-flex>
                <sc-grid row-gap="13">
                    <glo-info :info="getReceiptInfo({})" :labelStyle="{ width: '230rpx' }"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '出库总数', value: 55 }, { name: '收货总数', value: 55 }, { name: '差异数', value: '55' }]"></glo-statistics>
                    <glo-info :info="getOutboundDingHeInfo({})"></glo-info>
                    <glo-info :info="getReceiptDingHeInfo({})"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '出库工具总数', value: 55 }, { name: '收货工具总数', value: 55 }, { name: '差异数', value: '55' }]"></glo-statistics>
                    <glo-info :info="getOutboundToolInfo({})"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '钉盒遗失商品数', value: 0 }, { name: '工具组遗失数', value: 0 }, { name: '套包遗失商品数', value: 0 }, { name: '商品遗失数', value: 0 }, { name: '零散工具遗失数', value: 0 }]"></glo-statistics>
                </sc-grid>
                <view class="dotted-line">
                </view>
                <!-- 钉盒 -->
                <glo-chunk shadow>
                    <sc-flex ai="center" jc="between">
                        <glo-title title="钉盒标题" />
                        <sc-icon name="arrow-right" color="primary" size="20" />
                    </sc-flex>
                    <sc-flex ai="center" col-gap="33" padding="13rpx 0">
                        <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                        <glo-info :info="getDingHeInfo({})"></glo-info>
                    </sc-flex>
                    <glo-statistics :statistics="[{ name: '所含数量', value: 55 }]"></glo-statistics>
                </glo-chunk>
            </glo-chunk>
            <glo-chunk>
                <sc-flex ai="center" col-gap="23">
                    <glo-title title="归还信息"></glo-title>
                    <glo-tag type="primary" text="已归还"></glo-tag>
                </sc-flex>
                <sc-grid row-gap="13">
                    <glo-info :info="getReceiptInfo({})" :labelStyle="{ width: '230rpx' }"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '出库总数', value: 55 }, { name: '收货总数', value: 55 }, { name: '差异数', value: '55' }]"></glo-statistics>
                    <glo-info :info="getOutboundDingHeInfo({})"></glo-info>
                    <glo-info :info="getReceiptDingHeInfo({})"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '出库工具总数', value: 55 }, { name: '收货工具总数', value: 55 }, { name: '差异数', value: '55' }]"></glo-statistics>
                    <glo-info :info="getOutboundToolInfo({})"></glo-info>
                    <glo-statistics
                        :statistics="[{ name: '钉盒遗失商品数', value: 0 }, { name: '工具组遗失数', value: 0 }, { name: '套包遗失商品数', value: 0 }, { name: '商品遗失数', value: 0 }, { name: '零散工具遗失数', value: 0 }]"></glo-statistics>
                </sc-grid>
                <view class="dotted-line">
                </view>
                <!-- 钉盒 -->
                <glo-chunk shadow>
                    <sc-flex ai="center" jc="between">
                        <glo-title title="钉盒标题" />
                        <sc-icon name="arrow-right" color="primary" size="20" />
                    </sc-flex>
                    <sc-flex ai="center" col-gap="33" padding="13rpx 0">
                        <sc-image src="/static/empty.png" width="90" height="90" round="8"></sc-image>
                        <glo-info :info="getDingHeInfo({})"></glo-info>
                    </sc-flex>
                    <glo-statistics :statistics="[{ name: '所含数量', value: 55 }]"></glo-statistics>
                </glo-chunk>
            </glo-chunk>
        </glo-gutter>
        <sc-footer height="150" col-gap="45">
            <sc-button type="grey-blue" text="取消" width="265" height="75"></sc-button>
            <sc-button type="primary" text="复核出库" width="265" height="75"
                @click="$sc.push('/subOrder/pages/checkOutbound')"></sc-button>
        </sc-footer>
    </view>
</template>

<script setup>
const getSurgicalInfo = (item) =>
    [
        {
            type: "single",
            label: "订单号",
            value: item.orderNo
        },
        {
            type: "single",
            label: "订单时间",
            value: item.orderTime
        },
        {
            type: "single",
            label: "订单发布人",
            value: item.orderPublisher
        },
        {
            type: "single",
            label: "上游经销商名称",
            value: item.upstreamDistributorName
        },
        {
            type: "single",
            label: "经销商名称",
            value: item.distributorName
        },
        {
            type: "single",
            label: "医院名称",
            value: item.hospitalName
        },
        {
            type: "single",
            label: "省市区",
            value: item.provinceCityDistrict
        },
        {
            type: "single",
            label: "详细地址",
            value: item.detailedAddress
        },
        {
            type: "single",
            label: "联系人",
            value: item.contactPerson
        },
        {
            type: "single",
            label: "手术类型",
            value: item.surgeryType
        },
        {
            type: "single",
            label: "手术时间",
            value: item.surgeryTime
        },
        {
            type: "single",
            label: "科室",
            value: item.department
        },
        {
            type: "single",
            label: "医生名称",
            value: item.doctorName
        },
        {
            type: "single",
            label: "手术部位",
            value: item.surgerySite
        },
        {
            type: "single",
            label: "跟台价格",
            value: item.followUpPrice || '- ¥ 0.00元'
        },
        {
            type: "single",
            label: "患者姓名",
            value: item.patientName
        },
        {
            type: "single",
            label: "患者性别",
            value: item.patientGender
        },
        {
            type: "single",
            label: "患者年龄",
            value: item.patientAge
        },
        {
            type: "single",
            label: "住院号",
            value: item.hospitalizationNumber
        },
        {
            type: "single",
            label: "仓库",
            value: item.warehouse
        },
        {
            type: "single",
            label: "诊断",
            value: item.diagnosis
        },
        {
            type: "single",
            label: "是否紧急",
            value: item.isUrgent
        },
        {
            type: "single",
            label: "紧急事项",
            value: item.urgentMatters
        },
        {
            type: "single",
            label: "备注",
            value: item.remarks
        }
    ]
const getWithTaiInfo = (item) =>
    [
        {
            type: "single",
            label: "跟台人",
            value: item.followUpTime
        },
        {
            type: "single",
            label: "跟台时间",
            value: item.followUpMethod
        },
        {
            type: "single",
            label: "自备工具",
            value: item.followUpDoctor
        },
        {
            type: "single",
            label: "备注",
            value: item.followUpRemarks
        }
    ]
const getDeliveryInfo = (item) =>
    [
        {
            type: "single",
            label: "出库总数",
            value: item.totalOutboundCount
        },
        {
            type: "single",
            label: "出库钉盒数",
            value: item.nailBoxCount
        },
        {
            type: "single",
            label: "出库套包数",
            value: item.setPackageCount
        },
        {
            type: "single",
            label: "出库零散商品数",
            value: item.looseCommodityCount
        },
        {
            type: "single",
            label: "出库工具总数",
            value: item.totalToolCount
        },
        {
            type: "single",
            label: "出库工具组数",
            value: item.toolSetCount
        },
        {
            type: "single",
            label: "出库零散工具数",
            value: item.looseToolCount
        },
        {
            type: "single",
            label: "配送物流",
            value: item.logisticsCompany || '--'
        },
        {
            type: "single",
            label: "快递单号",
            value: item.trackingNumber || '--'
        },
        {
            type: "single",
            label: "收货人",
            value: item.consignee || '--'
        },
        {
            type: "single",
            label: "配送时间",
            value: item.deliveryTime || '--'
        },
        {
            type: "single",
            label: "配送方式",
            value: item.deliveryMethod || '--'
        },
        {
            type: "single",
            label: "出库备注",
            value: item.outboundRemarks || '--'
        }
    ]
const getDingHeInfo = (item) =>
    [

        {
            type: "multiple",
            grid: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "钉盒编码",
                    value: item.nailboxCode
                },
                {
                    type: "single",
                    label: "钉盒属性",
                    value: item.nailboxBarcode
                },
            ]
        },
        {
            type: "single",
            label: "钉盒条码",
            value: item.manufacturerName
        },
        {
            type: "single",
            label: "生产厂家",
            value: item.manufacturerName
        }
    ]
const getTaoBaoInfo = (item) =>
    [
        {
            type: "single",
            label: "套包编码",
            value: item.manufacturerName
        },
        {
            type: "single",
            label: "套包条码",
            value: item.manufacturerName
        },
        {
            type: "single",
            label: "生产厂家",
            value: item.manufacturerName
        }
    ]

const getCommodityInfoA = (item) =>
    [
        {
            type: "single",
            label: "UDI编码",
            value: item.udiCode,
        },
        {
            type: "single",
            label: "商品编码",
            value: item.productCode,
        },
        {
            type: "single",
            label: "生产厂家",
            value: item.manufacturerName,
        },
        {
            type: "single",
            label: "品牌",
            value: item.brandName,
        },
        {
            type: "multiple",
            columns: "1fr 1.5fr",
            list: [
                { type: "single", label: "规格", value: item.specifications },
                { type: "single", label: "型号", value: item.model },
            ],
        },
    ];
const getCommodityInfoB = (item) =>
    [
        {
            type: "multiple",
            columns: "1fr 295rpx",
            list: [
                { type: "single", label: "生产批号", value: item.productBatchNumber },
                { type: "single", label: "生产日期", value: item.productionDate },
            ],
        },
        {
            type: "multiple",
            columns: "1fr 295rpx",
            list: [
                { type: "single", label: "有效期", value: item.validityDate },
                { type: "single", label: "追踪码", value: item.trackingCode },
            ],
        },
        {
            type: "multiple",
            columns: "1fr 295rpx",
            list: [
                {
                    type: "single",
                    label: "灭菌批号",
                    value: item.sterilizationBatchNumber,
                },
                {
                    type: "single",
                    label: "灭菌效期",
                    value: item.sterilizationExpirationDate,
                },
            ],
        },
    ];
const getToolGroupInfo = (item) =>
    [
        {
            type: "single",
            label: "工具组编码",
            value: item.toolGroupCode,
        },
        {
            type: "single",
            label: "工具组条码",
            value: item.toolGroupBarcode,
        },
        {
            type: "single",
            label: "生产厂家",
            value: item.manufacturerName,
        },
    ];

const getToolInfo = (item) =>
    [
        {
            type: "single",
            label: "工具编码",
            value: item.toolCode,
        },
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "规格型号",
                    value: item.sterilizationBatchNumber,
                },
                {
                    type: "single",
                    label: "品牌",
                    value: item.sterilizationExpirationDate,
                },
            ],
        },
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "工具批号",
                    value: item.sterilizationBatchNumber,
                },
                {
                    type: "single",
                    label: "厂家编号",
                    value: item.sterilizationExpirationDate,
                },
            ],
        },
        {
            type: "single",
            label: "生产厂家",
            value: item.manufacturerName,
        },
    ];

const getReceiptInfo = (item) =>
    [
        {
            type: "single",
            label: "收货人",
            value: item.receiverName || '--',
        },
        {
            type: "single",
            label: "收货时间",
            value: item.receiptTime || '--',
        },
        {
            type: "single",
            label: "备注",
            value: item.receiptRemark || '--',
        },
        {
            type: "single",
            label: "消毒确认人",
            value: item.disinfectionConfirmer || '--',
        },
        {
            type: "single",
            label: "消毒确认时间",
            value: item.disinfectionConfirmTime || '--',
        },
        {
            type: "single",
            label: "手术确认人",
            value: item.surgeryConfirmer || '--',
        },
        {
            type: "single",
            label: "手术确认时间",
            value: item.surgeryConfirmTime || '--',
        },
    ]

const getOutboundDingHeInfo = (item) =>
    [
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "出库钉盒数",
                    value: item.nailBoxCount || 0,
                },
                {
                    type: "single",
                    label: "出库套包数",
                    value: item.kitCount || 0,
                },
            ],
        },
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "出库钉盒明细数",
                    value: item.nailBoxDetailCount || 0,
                },
                {
                    type: "single",
                    label: "出库套包明细数",
                    value: item.kitDetailCount || 0,
                },
            ],
        },
        {
            type: "single",
            label: "出库零碎商品数",
            value: item.looseItemCount || 0,
        },
    ]

const getReceiptDingHeInfo = (item) =>
    [
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "收货钉盒数",
                    value: item.nailBoxCount || 0,
                },
                {
                    type: "single",
                    label: "收货套包数",
                    value: item.kitCount || 0,
                },
            ],
        },
        {
            type: "multiple",
            columns: "1fr 1fr",
            list: [
                {
                    type: "single",
                    label: "收货钉盒明细数",
                    value: item.nailBoxDetailCount || 0,
                },
                {
                    type: "single",
                    label: "收货套包明细数",
                    value: item.kitDetailCount || 0,
                },
            ],
        },
        {
            type: "single",
            label: "收货零碎商品数",
            value: item.looseItemCount || 0,
        },
    ]

const getOutboundToolInfo = (item) =>
    [{
        type: "multiple",
        columns: "1fr 1fr",
        list: [
            {
                type: "single",
                label: "出库工具数",
                value: item.toolCount || 0,
            },
            {
                type: "single",
                label: "出库零碎工具数",
                value: item.looseToolCount || 0,
            },
        ],
    },
    {
        type: "multiple",
        columns: "1fr 1fr",
        list: [
            {
                type: "single",
                label: "出库工具明细数",
                value: item.toolDetailCount || 0,
            },
            {
                type: "single",
                label: "验货零碎工具数",
                value: item.inspectionLooseToolCount || 0,
            },
        ],
    },
    ]



</script>
<style lang="scss">
page {
    background: $color-bg !important;
}
</style>
<style lang="scss" scoped>
.tabs-wrap {
    width: 100vw;
    height: 75rpx;
    background-color: #fff;
}

.dotted-line {
    margin: 18rpx 0;
    border-bottom: 2rpx dashed #e6e6e6;
}
</style>
